import { http } from "@/common/service/service.js";

/**
 * 系统通知公告API
 */
export const announcement = {
  /**
   * 获取我的通知消息
   * @param {Object} params 查询参数
   * @param {number} params.pageNo 页码
   * @param {number} params.pageSize 每页大小
   * @returns {Promise}
   */
  getMyAnnouncementSend(params) {
    return http.get("/sys/sysAnnouncementSend/getMyAnnouncementSend", {
      params,
    });
  },

  /**
   * 获取通知发送列表
   * @param {Object} params 查询参数
   * @param {number} params.pageNo 页码
   * @param {number} params.pageSize 每页大小
   * @param {string} params.readFlag 阅读状态
   * @returns {Promise}
   */
  getAnnouncementSendList(params) {
    return http.get("/sys/sysAnnouncementSend/list", { params });
  },

  /**
   * 标记通知为已读
   * @param {Object} params 参数
   * @param {string} params.anntId 通知ID
   * @param {string} params.readFlag 已读标识 '1'-已读 '0'-未读
   * @returns {Promise}
   */
  markAsRead(params) {
    return http.put("/sys/sysAnnouncementSend/editByAnntIdAndUserId", params);
  },

  /**
   * 获取通知详情
   * @param {string} id 通知ID
   * @returns {Promise}
   */
  getAnnouncementDetail(id) {
    return http.get(`/sys/annountCement/queryById?id=${id}`);
  },

  /**
   * 获取通知列表
   * @param {Object} params 查询参数
   * @returns {Promise}
   */
  getAnnouncementList(params) {
    return http.get("/sys/annountCement/list", { params });
  },

  /**
   * 同步头部通知
   * @param {string} anntId 通知ID
   * @returns {Promise}
   */
  syncHeadNotification(anntId) {
    return http.get("/sys/annountCement/syncNotic", { params: { anntId } });
  },
};

export default announcement;
